	     _____________________________________________

	      "ESCAPE FROM OKTOGONIA" FOR ZX SPECTRUM 48K

			  victor@oktogonia.com
	     _____________________________________________


			 <http://oktogonia.com>


Table of Contents
_________________

1. Load instructions
2. History
3. Keyboard controls
4. Program description
5. License


1 Load instructions
===================

  To run the efo TAP file with "[Fuse - the Free Unix Spectrum Emulator]":

  ,----
  | fuse --machine 48 --auto-load efo.tap
  `----

  (tested with Fuse version 1.5.7)


[Fuse - the Free Unix Spectrum Emulator]
<http://fuse-emulator.sourceforge.net/>


2 History
=========

  Do you dare to escape from OKTOGONIA?

        "After the incident, everything has been covered with grey
        smoke. You can only see the screen of your
        swipping-structural-scanner five inches before your eyes."

        "Get your way to the lab exit sited at level one, with the
        only hint coming from the level id on the screen."

  - +60000 cells to explore
  - 254 levels deep
  - 2 room types (oktogon and square)
  - vector graphics
  - AMAZEENG!


3 Keyboard controls
===================

   Key:         1   2   3   4  5  6  7  8 
   Direction:  NW  SW  NE  SE  W  S  N  E 

  NOTE: (N)orth goes "up" and so on


4 Program description
=====================

  ,----
  | 1 DATA "68427153","344322234345432123",254,9,104: READ g$,d$,q,w,h: DIM r(10,9)
  | 2 DATA 0,0,2,0,2,2,0,2,-2,2,-2,0,-2,-2,0,-2,2,-2: LET l=q: LET c=w: LET i=l*l+c
  | 3 PAPER 0: INK 4: CLS: RESTORE 2: LET o=c-INT (c/2)*2: PLOT h,15: FOR z=1 TO 9
  | 4 GO SUB 10: RANDOMIZE e: FOR u=1 TO 9: LET r(z,u)=INT (RND*9): NEXT u: READ v,b
  | 5 LET r(10,z)=r(1,z)>5 OR r(z,z+4-(8 AND z>5))>5 OR w<1 OR w>=q*2 OR q>254
  | 6 LET p=8*(NOT z-INT (z/2)*2 OR o): IF l<2 THEN PRINT "escaped oktogonia!": STOP
  | 7 DRAW v*p,b*p: DRAW INK 4 AND r(10,z);v*p,b*p: DRAW v*p,b*p: NEXT z: PRINT l
  | 8 PAUSE 0: LET k=ABS CODE INKEY$-48: IF k<1+(4 AND NOT o) OR k>8 THEN GO TO 8
  | 9 LET z=CODE g$(k)-47: GO SUB 10: GO TO 2+(6 AND r(10,z)): REM * oktogonia.com
  | 10 LET q=(l+CODE d$(z)-51): LET w=(c+CODE d$(z+9)-51): LET e=q*q+w: RETURN
  `----

  NOTES: level=row, cell=column in map

  * Line 1: "One-time game initialization"
    + DATA/$g,$d,q,w,h are:
      - key->direction mapping
      - key->level/cell increment
      - initial level
      - initial cell
      - drawing starting offset
    + DIM r is:
      - row 1: current cell exits probability
      - 2-9 (8): adjacent cells exits probability
      - row 10: final current cell exits (current cell AND adjacent cell
        exit)
  * Line 2: "Current cell initialization"
    + DATA are relative x,y drawing factor pairs:
      - 1st. pair: current cell (0,0 = no wall)
      - 2nd. to 9th pairs: adjacent cells
    + l=level, c=cell, i=unique id of current cell
  * Line 3: "Plotter initizalization"
    + Trivial screen init. (paper, ink, cls, starting point)
    + o=boolean value "is cell an oktogon?"
    + z loop:
      - 1st. iteration: current cell
      - 2nd. to 9th. iterations: adjacent cells
  * Line 4: "Initialize exit probabilities for current and adjacent
    cells"
    + see "Line 1" for r description
    + READs "zth" x,y pair from "Line 2"
  * Line 5: "Calculate final current cell exits"
  * Line 6: "Calculate wall path + success endgame check"
    + p="plotter segment factor" takes 0 for diagonals if square (not o)
    + if reached exit (l<2), shows message and exits
  * Line 7: "Plot cell and show level indicator"
    + plots wall in 3 segment steps. middle segment gets open/closed
      state from r(10,wall)
  * Line 8: "Get key"
    + Ignores keys other than possibles directions for cell.
  * Line 9: "Check exit to candidate cell exists"
    + calls "Line 10" subroutine with candidate destination cell
    + checks current cell exit to candidate cell exists
    + jumps to "Line 8" if can't exit this way
    + jumps to "Line 2" if we can got to candidate cell
  * Line 10 (subroutine): "Calculate candidate cell"
    + calculate candidate destination cell level,cell,id
    + q,w,e=l,c,i of candidate destination cell


5 License
=========

  "Escape from OKTOGONIA" game code © victor@oktogonia.com. Released under CC BY-NC-ND 4.0.
  ([Creative Commons — Attribution-NonCommercial-NoDerivatives 4.0 International — CC BY-NC-ND 4.0])
  oktogonia.com web and the OKTOGONIA map are © victor@oktogonia.com. All rights reserved.


[Creative Commons — Attribution-NonCommercial-NoDerivatives 4.0 International — CC BY-NC-ND 4.0]
<https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode>
